GadvancedMarker

From Documentation

GadvancedMarker

Icon info.png Notice: This is an experimental version with support for the advanced marker API. We are proactively preparing for a potential future replacement of the current marker API. Your feedback is greatly appreciated!

Since zk-gmaps 5.0.0

Employment/Purpose

The component representing the Google Maps AdvancedMarkerElement that you can use to indicate a specific point by latitude and longitude. The advanced marker replaces the GMarker, which Google Maps APIs have deprecated. (As of February 21st, 2024 (v3.56), google.maps.Marker is deprecated.)

Migration Requirements

To use advanced markers, additional configuration is required on the associated map. Follow the official migration guide for more information.

Specify mapId

Icon info.png Notice: Advanced markers are only available for maps that have received a mapId

To allow for this new configuration, the GMaps component in the development branch now has a new setter: mapId.

mapId can be set from java, using org.zkoss.gmaps.Gmaps.setMapId(String) or in zul with <gmaps mapId="String"/>.

The steps necessary to obtain a mapId are:

  1. Register your developer account on the Google Maps developer console, with the account supporting your Google Maps API key.
  2. In "Map Style": Create a map style
  3. In "Map Management": Create a Map ID
  4. Associate your Map ID and your Map style
  5. Copy the Map ID field, and use either Java or Zul to set the map ID on your Gmaps component.

Once these steps are completed, you can add GAdvancedMarker descendants to your Gmaps map component. This can be done in Java, or in Zul.

Example

    <gmaps height="500px" width="500px" mapId="your-map-id">
        <gadvancedmarker lat="37.4410" lng="-122.1490"/>
    </gmaps>

Supported Events

Supported Children

*None



Last Update : 2024/12/24

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.